package com.mail.anteater.util;

import java.util.ArrayList;

import org.apache.log4j.Logger;

import com.mail.anteater.hibernate.mapping.Inbox;
import com.mail.anteater.hibernate.mapping.InboxListing;
import com.mail.anteater.hibernate.mapping.Outbox;
import com.mail.anteater.hibernate.mapping.OutboxListing;
import com.mail.anteater.hibernate.mapping.TempInbox;
import com.mail.anteater.hibernate.mapping.TempOutbox;

public class Func {

	final static Logger logger = Logger.getLogger(Func.class);
	public static final int SAME_DAY = 1;
	public static final int BEFORE = 2;
	public static final int AFTER = 3;
	
	public static void println(Object output) {
		System.out.println(output);
	}

	public static String getDelimiteredNumber(ArrayList<String> numberList){
		String list = "";
		for(int i = 0; i < numberList.size(); i++){
			list += numberList.get(i);
			if(i+1 < numberList.size()){
				list += ",";
			}
		}
		return list;
	}
	
	public static Inbox castInbox(TempInbox temp){
		if(temp == null){
			return null;
		}
		Inbox inbox = new Inbox();
		inbox.setId(temp.getId());
		inbox.setCc(temp.getCc());
		inbox.setSubject(temp.getSubject());
		inbox.setContent(temp.getContent());
		inbox.setInstruction(temp.getInstruction());
		inbox.setPriority(temp.getPriority());
		inbox.setType(temp.getType());
		inbox.setReceiveDt(temp.getReceiveDt());
		inbox.setReceivers(temp.getReceivers());
		inbox.setSender(temp.getSender());
		inbox.setStatus(temp.getStatus());
		inbox.setUserId(temp.getUserId());

		return inbox;
	}
	
	public static TempInbox castTempInbox(Inbox temp){
		if(temp == null){
			return null;
		}
		TempInbox inbox = new TempInbox();
		inbox.setId(temp.getId());
		inbox.setCc(temp.getCc());
		inbox.setSubject(temp.getSubject());
		inbox.setContent(temp.getContent());
		inbox.setInstruction(temp.getInstruction());
		inbox.setPriority(temp.getPriority());
		inbox.setType(temp.getType());
		inbox.setReceiveDt(temp.getReceiveDt());
		inbox.setReceivers(temp.getReceivers());
		inbox.setSender(temp.getSender());
		inbox.setStatus(temp.getStatus());
		inbox.setUserId(temp.getUserId());

		return inbox;
	}
	
	public static TempInbox castTempInbox(InboxListing temp){
		if(temp == null){
			return null;
		}
		TempInbox inbox = new TempInbox();
		inbox.setId(temp.getId());
		inbox.setCc(temp.getCc());
		inbox.setSubject(temp.getSubject());
		inbox.setContent(temp.getContent());
		inbox.setInstruction(temp.getInstruction());
		inbox.setPriority(temp.getPriority());
		inbox.setType(temp.getType());
		inbox.setReceiveDt(temp.getReceiveDt());
		inbox.setReceivers(temp.getReceivers());
		inbox.setSender(temp.getSender());
		inbox.setStatus(temp.getStatus());
		inbox.setUserId(temp.getUserId());

		return inbox;
	}
	
	public static Outbox castOutbox(TempOutbox temp){
		if(temp == null){
			return null;
		}
		Outbox outbox = new Outbox();
		outbox.setId(temp.getId());
		outbox.setCc(temp.getCc());
		outbox.setSubject(temp.getSubject());
		outbox.setContent(temp.getContent());
		outbox.setInstruction(temp.getInstruction());
		outbox.setPriority(temp.getPriority());
		outbox.setType(temp.getType());
		outbox.setSentDt(temp.getSentDt());
		outbox.setReceivers(temp.getReceivers());
		outbox.setUserId(temp.getUserId());

		return outbox;
	}
	
	public static TempOutbox castTempOutbox(Outbox temp){
		if(temp == null){
			return null;
		}
		TempOutbox outbox = new TempOutbox();
		outbox.setId(temp.getId());
		outbox.setCc(temp.getCc());
		outbox.setSubject(temp.getSubject());
		outbox.setContent(temp.getContent());
		outbox.setInstruction(temp.getInstruction());
		outbox.setPriority(temp.getPriority());
		outbox.setType(temp.getType());
		outbox.setSentDt(temp.getSentDt());
		outbox.setReceivers(temp.getReceivers());
		outbox.setUserId(temp.getUserId());

		return outbox;
	}
	
	public static TempOutbox castTempOutbox(OutboxListing temp){
		if(temp == null){
			return null;
		}
		TempOutbox outbox = new TempOutbox();
		outbox.setId(temp.getId());
		outbox.setCc(temp.getCc());
		outbox.setSubject(temp.getSubject());
		outbox.setContent(temp.getContent());
		outbox.setInstruction(temp.getInstruction());
		outbox.setPriority(temp.getPriority());
		outbox.setType(temp.getType());
		outbox.setSentDt(temp.getSentDt());
		outbox.setReceivers(temp.getReceivers());
		outbox.setUserId(temp.getUserId());

		return outbox;
	}
}
